pacman::p_load(sf, tidyverse, MCI, tmap, ggstatsplot)In-class Ex10
1 Modelling Spatial Interaction: Huff and MCI Models
1.1 Overview
Market area analysis defines and studies where customers originate, using demographics, spending, competition, and observation to guide location, marketing, and expansion decisions. The Huff model estimates store choice probabilities and market share from attractiveness and distance, helping businesses delineate trade areas and forecast revenue among competing outlets and potential profitability.
1.2 Getting Started
Before we getting started, it is important for us to install the necessary R packages and launch them into RStudio environment.
1.3 Importing geospatial data
stores <- st_read(
dsn = "/Users/cktan/Desktop/SMU/01_Geospatial Analytics (ISSS626)/Hands-on_Ex/In-Class_Ex10/data/geospatial",
layer = "STORES_TC")Reading layer `STORES_TC' from data source
`/Users/cktan/Desktop/SMU/01_Geospatial Analytics (ISSS626)/Hands-on_Ex/In-Class_Ex10/data/geospatial'
using driver `ESRI Shapefile'
Simple feature collection with 28 features and 3 fields
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 202702.9 ymin: 2662196 xmax: 232773.2 ymax: 2693557
Projected CRS: TWD97 / TM2 zone 121
town <- st_read(
dsn = "/Users/cktan/Desktop/SMU/01_Geospatial Analytics (ISSS626)/Hands-on_Ex/In-Class_Ex10/data/geospatial",
layer = "TOWN_TC")Reading layer `TOWN_TC' from data source
`/Users/cktan/Desktop/SMU/01_Geospatial Analytics (ISSS626)/Hands-on_Ex/In-Class_Ex10/data/geospatial'
using driver `ESRI Shapefile'
Simple feature collection with 28 features and 7 fields
Geometry type: POLYGON
Dimension: XY
Bounding box: xmin: 194797.1 ymin: 2654887 xmax: 240450.2 ymax: 2703838
Projected CRS: TWD97 / TM2 zone 121
village <- st_read(
dsn = "/Users/cktan/Desktop/SMU/01_Geospatial Analytics (ISSS626)/Hands-on_Ex/In-Class_Ex10/data/geospatial",
layer = "VILLAGE_TC")Reading layer `VILLAGE_TC' from data source
`/Users/cktan/Desktop/SMU/01_Geospatial Analytics (ISSS626)/Hands-on_Ex/In-Class_Ex10/data/geospatial'
using driver `ESRI Shapefile'
Simple feature collection with 622 features and 10 fields
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: 194797.1 ymin: 2654887 xmax: 240450.2 ymax: 2703838
Projected CRS: TWD97 / TM2 zone 121
The output print above shown that the three data sets are in TWD97 / TM2 zone 121 (i.e epsg: 3826) projected coordinates systems.
For any geospatial analysis, it is important to check and confirm that all the geospatial data are in the similar projected coodinates system.
tmap_mode("view")ℹ tmap mode set to "view".
tm_shape(town) +
tm_polygons() +
tm_shape(village) +
tm_polygons() +
tm_shape(stores) +
tm_dots()Registered S3 method overwritten by 'jsonify':
method from
print.json jsonlite